using UnityEngine;
using System.Collections;

public class _Victory1 : MonoBehaviour {

	public static bool stop = false;
	Vector2 realS;
	
	void Start () 
	{
		gameObject.AddComponent("MeshRenderer");
		gameObject.AddComponent("MeshFilter");
		gameObject.AddComponent("BoxCollider");

		
		realS.x = 3 * Menu.ns.x;
		realS.y = 5 * Menu.ns.y;
		
		this.gameObject.transform.position = new Vector3(transform.position.x * Menu.ns.x , realS.y , 0);

		
		Mesh mesh = Quad.Create(realS.x , realS.y );
		gameObject.GetComponent<MeshFilter>().mesh = mesh;
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Material");
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Transparent");
		gameObject.GetComponent<MeshRenderer>().material.mainTexture = (Texture) Resources.Load ("Texturas/P_F");
		gameObject.GetComponent<BoxCollider>().size = new Vector3(realS.x , realS.y * 20 , 0);

		
		stop = false;
	}
	
	void Update () 
	{
		if(transform.position.x <= 17)
			stop = true;
		
		else 
			transform.Translate(_Speed.speed , 0 , 0);
			
		
	}
	
	void OnCollisionEnter(Collision c)
	{
		if(c.gameObject.name == "Player")
		{
			Application.LoadLevel("SelecaoCenas");
			if(selecaoCenas.kid != 4)
			{
				bancoDeDados.Save(2);
			}
		}
	}
}
